from case.po.basePage.base_page import BasePage
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

class LoginPage(BasePage):
    url="https://afterwin.cn/login"
    login_name=(By.ID,"userName")
    login_password=(By.ID,"passWord")
    login_button=(By.CSS_SELECTOR,"button[type='submit']")

    # 对用户名框进行内容的输入
    def input_username(self, username):
        self.locator(self.login_name).send_keys(username)

    # 对密码框进行内容的输入
    def input_password(self, password):
        self.locator(self.login_password).send_keys(password)

    # 点击登录按钮，实现登录
    def click_login_element(self):
        self.locator(self.login_button).click()

    def check(self,username,password):
        self.visit(self.url)
        self.input_username(username)
        self.input_password(password)
        self.click_login_element()

if __name__ =="__main__":
    driver =webdriver.Chrome()
    sp = LoginPage(driver)
    sp.check("fandanping","fandanping521")
